/**
 * 
 */
package com.monkeyboy.security.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.monkeyboy.security.constant.GlobalException;

/**
 * @Description
 *
 * @author Gavin<br>
 *         2019年8月24日
 */
@ControllerAdvice
public class ControllerExceptionHandler {
	@ExceptionHandler(GlobalException.class)
	@ResponseBody
	@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
	public Map<String, Object> handleGlobalException(GlobalException ex) {
		ex.printStackTrace();
		Map<String, Object> res = new HashMap<String, Object>();
		res.put("code", "5000");
		res.put("message", "springboot异常处理");
		return res;
	}
}
